package com.bookdresser.utils;

import java.io.File;
import android.os.Environment;
public class CreateCachFolderAndFile {
	public boolean createXml() {
		
		try {
			File file = new File(SystemConstants.CACHE_BOOKS_DATA_XML_PATH);
			if (!file.exists()) {
				file.createNewFile();
			}
			/*FileOutputStream fo = new FileOutputStream(file, true);
			fo.write(meg.getBytes("UTF-8"));
			fo.close();*/
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return false;
		}
		return true;
	}

	public boolean createFile() {
		if (Environment.getExternalStorageState().equals(
				android.os.Environment.MEDIA_MOUNTED)) {
			File firstFolder = new File(SystemConstants.CACHE_FISRT_FOLDER_BOOK_DATA);
			if (!firstFolder.exists()) {
				firstFolder.mkdir();
			}
			File imageFolder = new File(SystemConstants.CACHE_SECOND_FOLDER_IMAGES);
			if (!imageFolder.exists()) {
				imageFolder.mkdir();
			}
			File xmlFolder = new File(SystemConstants.CACHE_SECOND_FOLDER_XMLS);
			if (!xmlFolder.exists()) {
				xmlFolder.mkdir();
			}
		} else {
			return false;
		}
		return true;
	}
}

